using System.Windows.Controls;
using Microsoft.Practices.Prism.ViewModel;
using CharacterCreation.Data.Services;
using CharacterCreation.Data.Models;

namespace CharacterCreation.Views {
    /// <summary>
    /// The character view model
    /// </summary>
    public partial class CharacterViewModel : NotificationObject {

        private CharacterService _characterService = CharacterService.CreateInstance();

        
        /// <summary>
        /// Gets or sets the CurrentCharacter
        /// </summary>
        public Character CurrentCharacter {
            get { return _characterService.CurrentItem; }
        }

        /// <summary>
        /// Constructor
        /// </summary>
        public CharacterViewModel() {
            _characterService.PropertyChanged += (s, e) => {
                if (e.PropertyName == "CurrentItem")
                    RaisePropertyChanged("CurrentCharacter");
            };
        }
    }
}